package com.jhinwins.equipmenteb.equipmentebserver.entity;

import com.jhinwins.equipmenteb.equipmentebserver.entity.common.GenerateId;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

/**
 * 一个商品
 */
@Table(name = "product")
@Entity
public class ProductBean extends GenerateId {
    private String name;
    private String shortDesc;
    /**
     * 商品类型
     */
    @ManyToOne
    private ProductTypeBean productTypeBean;
    /**
     * 商品拥有的属性
     */
    @OneToMany(cascade = CascadeType.ALL)
    private List<SpecificationBean> specificationBeans = new ArrayList<>();

    /**
     * 商品拥有的图片
     */
    @OneToMany(cascade = CascadeType.ALL)
    private List<ProductImgBean> productImgBeans = new ArrayList<>();

    /**
     * 商品介绍（全用图片介绍）
     */
    @ManyToOne(cascade = CascadeType.ALL)
    private ProductImgBean productIntroduce;

    public ProductBean(Long id) {
        super(id);
    }

    public ProductBean() {
    }

    public ProductImgBean getProductIntroduce() {
        return productIntroduce;
    }

    public void setProductIntroduce(ProductImgBean productIntroduce) {
        this.productIntroduce = productIntroduce;
    }

    public List<ProductImgBean> getProductImgBeans() {
        return productImgBeans;
    }

    public void setProductImgBeans(List<ProductImgBean> productImgBeans) {
        this.productImgBeans = productImgBeans;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getShortDesc() {
        return shortDesc;
    }

    public void setShortDesc(String shortDesc) {
        this.shortDesc = shortDesc;
    }

    public ProductTypeBean getProductTypeBean() {
        return productTypeBean;
    }

    public void setProductTypeBean(ProductTypeBean productTypeBean) {
        this.productTypeBean = productTypeBean;
    }

    public List<SpecificationBean> getSpecificationBeans() {
        return specificationBeans;
    }

    public void setSpecificationBeans(List<SpecificationBean> specificationBeans) {
        this.specificationBeans = specificationBeans;
    }
}
